﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Web.Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
    <title>档案系统综合服务平台</title>
    <script type="text/javascript" src="Javascript/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="Javascript/sysNongliTime.js"></script>
<link href="App_Themes/NewPage/Styles/layout.css" rel="stylesheet" type="text/css" />
    <script src="Javascript/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        //加载顶部导航菜单
        function LoadNavigateMenu() {
            $.ajax({
                type: "get",
                url: "Views/SystemLogin/GetNavigateMenu.aspx",
                data: "",
                cache: false,
                success: function(result) {
                    //添加分类菜单      
                    if (result.toString().toLowerCase() == "empty")//如果返回的是字符串"Empty"，表示是叶节点，不再继续加载
                    {
                        return false;
                    }
                    else if (result.toString().indexOf('<html>') == 0) {//包含<html>标签的是表示错误页面，不加载
                        return false;
                    }
                    else {
                        if (result == "" || result.toLowerCase().indexOf('<html>') == 0) {
                            alert("网络故障数据加载失败");
                        }
                        var Navigate = $('#menu');
                        result = result.substring(0, result.indexOf("<html>"));
                        var list = eval(result);
                        var shtml = "<ul>";
                        $(list).each(function(i, item) {
                            if (item.menuId == "ePlanet.Desktop") {
                                shtml += "<li class='current' id='" + item.MENUID + "'><a  href='javascript:void(0);' >" + item.MENUTEXT + "</a></li>";
                            }
                            else {
                                shtml += "<li id='" + item.MENUID + "'><a href='javascript:void(0);' >" + item.MENUTEXT + "</a></li>";
                            }
                        });
                        shtml += "</ul>";
                        Navigate.html(shtml);
                        // 为菜单绑定响应事件
                        var menu_anthour = Navigate.find("li");
                        menu_anthour.each(function() {
                            $(this).bind('click',
		        function() {
		            var item = $(this);
		            var _m_id = item.attr('id');
		            var _m_title = item.text();
		            Navigate.find("li[class='current']").removeClass("current");
		            var obj = $(this);
		            $(this).addClass("current");
		            if (_m_id == "ePlanet.Desktop") {
		                changeContent("Content.aspx"); //如果是首页，则加载Content
		                return false;
		            }
		            else {
		                //注意，首页是弹出新窗口，子页面创建的时候是刷新链接
		                _m_id = encodeURIComponent(_m_id);
		                _m_title = encodeURIComponent(_m_title);
		                changeContent("Default2.aspx?id=" + _m_id + "&title=" + _m_title + ""); //不是首页，则加载子页面
		                return false;
		            }
		        });
             });
                    }
                },
                error: function(xhq, textStatus, errorThrown) {
                    alert(xhq.responseText);
                }
            });
        }
        //全文检索
        function fulltext_search() {
            var text = $("#fulltext").val();
            text = encodeURIComponent(text);
            window.open("Views/FullTextRetrieval/QueryResultsSearch.aspx?searchText=" + text);
        }
        function enterKey(e) {
            var code;
            if (!e) {
                var e = window.event;
            }
            if (e.keyCode) {
                code = e.keyCode;
            }
            else if (e.which) {
                code = e.which;
            }
            if (code == 13) {
                fulltext_search();
                return false;
            }
        }
        function changeContent(src) {
            $("#ifr_cnt").attr("src", src);
        }

        function getworktodo() {
            $.ajax({
                type: "POST",
                async: "true",
                contentType: "application/json",
                url: "Views/WorkAssistant/CommissionService.asmx/GetCommissionDataCount",
                data: '{"userid":"' + $('#currentuseid').val() + '"}',
                dataType: "json",
                success: function(result) {
                    $("#workstodo").html("(" + result.d + ")");
                },
                error: function(result, status) {
                    if (status == 'error') {
                        //$("#workstodo").html("(0)");
                    }
                }


            })
        }
        
    </script>
    
    <style type="text/css">
        html,body,#rootPrt{ margin:0; padding:0; overflow:hidden;}
        #rootPrt{ overflow-x:hidden; position:relative;}
        #headPrt{ position:relative;}
        #ifr_cnt_prt{ position:relative;}
    </style>
    <script type="text/javascript">
        var RF_Resize = function() {
            var win = $(window), wh = { w: win.width(), h: win.height(), head_h: $('#headPrt').height() };
            $('#rootPrt').css({ width: wh.w, height: wh.h });
            if (wh.w < 1024) { wh.w = 1024; wh.h -= 16; }
            $('#headPrt').width(wh.w);
            $('#ifr_cnt_prt').css({ width: wh.w, height: wh.h - wh.head_h });
        }

        $(function() {
            LoadNavigateMenu();
            //绑定系统时间
            window.setInterval(headjs.nongliTime, 1000);

            //获取代办条数
            getworktodo();
            //自适应大小
            RF_Resize();
            //绑定keydown事件
            $("#fulltext").bind("keydown", enterKey);
            $(window).resize(function() { RF_Resize(); });

            $('#ifr_cnt_prt').html('<iframe id="ifr_cnt" name="ifr_cnt" src="Content.aspx" width="100%" height="100%" frameborder="0" marginheight="0" marginwidth="0"  noresize="noresize" ></iframe>');
            window.setInterval(getworktodo, 300000);
        });
    </script>
</head>
<body>
<form id="form1" runat="server">
<div id="rootPrt">
    <div id="headPrt">
        <div id="header">
            <div id="logo"></div>
                      <div id="time"><img src="App_Themes/NewPage/icons/info_time.png" width="16" height="16" class="icon1" />
            <!-- #BeginDate format:fCh2m --><span></span><!-- #EndDate -->
          </div>
            <div id="search">
              <%--  <input id="fulltext" name="fulltext" type="text" class="search_input"  onblur="if(this.value=='')value='- 请输入关键字 -';" onfocus="if(this.value=='- 请输入关键字 -')value='';" value="- 请输入关键字 -" size="10" />
                <input type="Button" name="Button" class="search_btn" onclick="fulltext_search();" />--%>
            </div>
        </div>
    
        <!----- 导航栏 start ----->
        <div id="navigation">
          <!-----当前用户信息 start----->
          <div id="user"><img src="App_Themes/NewPage/icons/info_user.png" width="16" height="16" class="icon1" />欢迎您，<%=this.CurrentUser.User_Name %></div>
          <!-----当前用户信息 end----->
          <%--<div id="option">
            <ul>
              <li><a href="#"><img alt="发即时消息" src="App_Themes/NewPage/icons/quick_jishixiaoxi.png" width="16" height="16" class="icon1" /> <span>即时消息</span></a></li>
            <li><a href=#"><img alt="通讯录查询" src="App_Themes/NewPage/icons/quick_tongxunlu.png" width="16" height="16" class="icon1"/> <span>通讯录</span></a></li>
            <li><a href="#"><img alt="会议室预定" src="App_Themes/NewPage/icons/quick_huiyishi.png" width="16" height="16" class="icon1" /> <span>会议室预订</span></a></li>
             <li><a href="#"><img alt="" height="16" width="16" class="icons1" src="App_Themes/NewPage/icons/leftnav_daibangongzuo.png" /> <span>待办工作<span style=" color:#FF0000;" id="workstodo"></span></span></a></li>
            </ul>
          </div>--%>
                    <div id="option-right">
            <ul>
          <li><a href="Views/SystemLogin/Logout.aspx"><img src="App_Themes/NewPage/icons/user_tuichu.png" width="16" height="16" class="icon1" />注销</a></li>
            </ul>
          </div>
          <div id="menu">
            <%--<ul>
              <li class="current"><a href="javascript:void(0);">系统首页</a></li>
              <!--“current”套用于当前页面情况下，此时不挂链接-->
              <li><a href="javascript:void(0);">工作助手</a></li>
              <li><a href="javascript:void(0);">信息发布</a></li>
              <li><a href="javascript:void(0);">文件搜索</a></li>
              <li><a href="javascript:void(0);">系统设置</a></li>
              <li><a href="javascript:void(0);">个人设置</a></li>
              <li><a href="javascript:void(0);">会议管理</a></li>
              <li><a href="javascript:void(0);">管理流程</a></li>
            </ul>--%>
          </div>
        </div>
        <!----- 导航栏 end ----->
        <script type="text/javascript">
            var headjs = {
                flashMenu: function() {
                    $("#menu").find("li").bind('click', function() {
                        $("#menu").find("li[class='current']").removeClass("current");
                        var obj = $(this);
                        $(this).addClass("current");
                    });
                },
                nongliTime: function() {
                    //绑定系统时间
                    var elem = $("#time span")[0];
                    var nongli = new NongLi();
                    NongLi.updatePubTime(elem);
                }
            };
        </script>
    </div>
    <!--Content部分开始-->
    <div id="ifr_cnt_prt"></div>
    <input type="hidden" runat="server" id="currentuseid" value="" />
</div>
</form>
</body>
</html>
